
package com.punch.common.feign;


import com.punch.common.constant.ServiceNameConstants;
import com.punch.common.feign.fallback.FeignClassServiceFallbackFactory;
import com.punch.common.vo.course.AppClassVO;
import com.punch.common.vo.course.ClassesVO;
import com.punch.common.vo.course.CourseSettlementVO;
import com.punch.common.vo.course.MaterialSettlementVO;
import com.punch.common.vo.course.classes.FeignClassVO;
import com.punch.common.vo.course.report.CourseReportVO;
import com.punch.common.vo.course.report.OrganReportVO;
import com.punch.common.vo.order.StudentCourseClassVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 班级课程服务
 */
@FeignClient(name = ServiceNameConstants.COURSE_SERVICE, fallbackFactory = FeignClassServiceFallbackFactory.class, decode404 = true)
public interface FeignClassService {


    /**
     * 服务间调用查询班级详情
     *
     * @param courseClassId 班级记录id
     * @return ClassVO
     * @author xiaol
     * @since 2020/7/14 10:51
     */
    @GetMapping(value = "/course/class/feign/{courseClassId}", produces = "application/json; charset=utf-8")
    FeignClassVO getFeignClassById(@PathVariable("courseClassId") Long courseClassId);

    /**
     * 根据学校id查询对应的入驻机构数量
     *
     * @param schoolId 学校id
     * @return Integer
     * @author xiaol
     * @since 2020/7/14 10:51
     */
    @GetMapping(value = "/organ/count/{schoolId}", produces = "application/json; charset=utf-8")
    List<OrganReportVO> getOrganCount(@PathVariable("schoolId") Long schoolId);

    /**
     * 根据创建人id（学校id）查询对应的开课数量
     *
     * @param createId 学校id
     * @return Integer
     * @author xiaol
     * @since 2020/7/14 10:51
     */
    @GetMapping("/course/count/{createId}")
    List<CourseReportVO> getCourseCount(@PathVariable("createId") Long createId);

    /**
     * 根据课程分类id查询课程详情列表
     *
     * @param categoryId 课程分类id
     * @return List<ClassesVO>
     * @author xiaol
     * @since 2020/7/23
     */
    @GetMapping(value = "/classes/{categoryId}", produces = "application/json; charset=utf-8")
    List<ClassesVO> getClasses(@PathVariable("categoryId") Long categoryId);

    /**
     * 修改班级课程的报名人数
     *
     * @param courseClassId 班级课程id
     */
    @PutMapping(value = "/class/{courseClassId}/sign-up-number", produces = "application/json; charset=utf-8")
    Boolean updateSignUpNumber(@PathVariable("courseClassId") Long courseClassId);


    /**
     * 取消订单修改班级课程的报名人数
     *
     * @param courseClassId 班级课程id
     */
    @PutMapping(value = "/class/{courseClassId}/sign-up-cancel", produces = "application/json; charset=utf-8")
    Boolean cancelSignUpNumber(@PathVariable("courseClassId") Long courseClassId);

    /**
     * 获取课程班级教具结算信息
     *
     * @param courseClassId 班级课程id
     */
    @PutMapping(value = "/class/{courseClassId}/material-settlement", produces = "application/json; charset=utf-8")
    MaterialSettlementVO getMaterialSettlement(@PathVariable("courseClassId") Long courseClassId);

    /**
     * 查找未结算完成的课程,每月执行一次
     */
    @PutMapping(value = "/class/course/un-settlement", produces = "application/json; charset=utf-8")
    List<CourseSettlementVO> listCourseSettlement();


    /**
     * 保存学生课表
     *
     * @param classId              课程id
     * @param studentCourseClassVO 学生信息
     * @return long
     */
    @PostMapping(value = "/course-schedule/{classId}", produces = "application/json; charset=utf-8")
    Long saveStudentCourseSchedule(@PathVariable("classId") Long classId, @RequestBody StudentCourseClassVO studentCourseClassVO);

    /**
     * 获取学生当前学期出勤率
     *
     * @param studentId 学生id
     * @param areaId    地区id,用于查询学期
     * @return double
     */
    @GetMapping(value = "/course-schedule/attendance-rate/{studentId}", produces = "application/json; charset=utf-8")
    Double attendanceRate(@PathVariable("studentId") Long studentId, @RequestParam(name = "areaId") Integer areaId);

    /**
     * 修改机构未审核状态下提交的课程
     */
    @PutMapping(value = "/courses/un-audit-commit/{orgId}", produces = "application/json; charset=utf-8")
    void updateUnAuditCommit(@PathVariable("orgId") Long orgId);
}

